package thread;

public class MultiThread {
    public static void work(String tag) {
        for (int i = 0; i < 10; i++) {
            System.out.println("from [" + tag + "] Hello! This is " + i);
        }
    }

    public static void main(String[] args) {
        CustomThread t1 = new CustomThread();
        Thread t2 = new Thread(new Work());
        t1.start();
        t2.start();
    }
}

class CustomThread extends Thread {
    @Override
    public void run() {
        MultiThread.work(this.getClass().getName());
    }
}

class Work implements Runnable {
    @Override
    public void run() {
        MultiThread.work(this.getClass().getName());
    }
}
